package com.bidepan.特殊类型注入;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestEmp {
    //普通类型注入
    @Test
    public void test1(){
        ApplicationContext context = new ClassPathXmlApplicationContext("特殊类型注入.xml");

        Emp emp = context.getBean("Emp", Emp.class);
        emp.work();
    }

    //内部bean注入
    @Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("特殊类型注入.xml");

        Emp emp = context.getBean("Emp2", Emp.class);
        emp.work();
    }

    //外部bean注入
    @Test
    public void test3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("特殊类型注入.xml");

        Emp emp = context.getBean("Emp3", Emp.class);
        emp.work();
    }

    //数组类型注入
    @Test
    public void test4(){
        ApplicationContext context = new ClassPathXmlApplicationContext("特殊类型注入.xml");
        Emp emp = context.getBean("Emp4", Emp.class);
        emp.work();
    }

    //List<Emp>类型注入
    @Test
    public void test5(){
        ApplicationContext context= new ClassPathXmlApplicationContext("List类型注入.xml");
        Dept dept = context.getBean("dept",Dept.class);
        dept.info();
    }

}
